home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 4230
- ClientLeft = 1095
- ClientTop = 1515
- ClientWidth = 6720
- Height = 4635
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 4230
- ScaleWidth = 6720
- Top = 1170
- Width = 6840
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_Load()
- Dim db As DATABASE
- Dim dbName As String
- Dim rs As Recordset
- Dim s As String
- On Error GoTo LoadError
- ' Get the database name and open the database.
- dbName = BiblioPath() ' BiblioPath is a function in READINI.BAS
- 10 Set db = DBEngine.Workspaces(0).OpenDatabase(dbName)
- ' This statement will cause an error, because there's no such table
- ' as No Such Table.
- 20 Set rs = db.OpenRecordset("No Such Table", dbOpenTable)
- ' There is a table named Titles, so this one should work.
- 30 Set rs = db.OpenRecordset("Titles", dbOpenTable)
- ' There's no such field as No Such Field, so here's another error.
- 40 s = rs![No Such Field]
- ' This causes an error because Year Published only takes numeric values.
- 50 rs![Year Published] = "XYZ"
- ' Finally!
- 60 End
- Exit Sub
- LoadError:
- MsgBox "Error #" & Str$(Err.Number) & " at Line " & Str$(Erl) & " - " & Err.Description & " - reported by " & Err.Source
- Resume Next
- End Sub
-